﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
int userid=Integer.parseInt(request.getAttribute("userid").toString());
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
   <base href="<%=basePath %>">
    <title>管理页面</title>
    <link href="<%=basePath %>attend/frame/images/skin.css" rel="stylesheet" type="text/css" />
    <link href="<%=basePath %>attend/css/base.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" type="text/css" href="<%=basePath %>attend/js/lhgcalendar/css/demo.css"/>
	
	<script language="JavaScript" type="text/javascript" src="<%=basePath %>attend/js/jquery-1.7.1.min.js"></script>
	<script language="javascript" type="text/javascript" src="<%=basePath %>attend/js/choose.js"></script>
	<script type="text/javascript" src="<%=basePath %>attend/js/lhgdialog/lhgdialog.min.js?skin=discuz"></script>
	<script language="JavaScript" type="text/javascript" src="<%=basePath %>attend/js/lhgcalendar/lhgcalendar.min.js" defer="defer"></script>
	<script type="text/javascript">
		function reloadGo(sta) {
			var txtCurrentPage = document.getElementById("txtCurrentPage").value;
			var type = "^\\d+$";
			var re = new RegExp(type);
			if (txtCurrentPage.match(re) == null) {
				document.getElementById("txtCurrentPage").value="";
				alert("请输入整数!");
				return;
			}
			window.location.href = "Manager?sta="+sta+"&pagerMethod=go&currentPage=" + txtCurrentPage;
		}
		function excuteDel(){
			if(window.confirm("考勤是否没问题，你确定吗？")){
				return true;
			}else{
				return false;
			}
		}
		function openManage(date,userId)
		{
		    $.dialog({ 
		    	lock: true,
		    	title: date+' 打卡详细记录',
		    	content:'url:<%=basePath %>attend/myattend/p.jsp?a='+date+'&b='+userId,
		    	width: '500px',
				height: 380,
				max: false
		    });
		}
	</script>
</head> 
  
  <body>
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" valign="top"><img src="<%=basePath %>attend/frame/images/left-top-right.gif" width="17" height="29"/></td>
    <td valign="top" background="<%=basePath %>attend/frame/images/content-bg.gif">
	    <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
	      <tr>
	        <td height="31">
		        <div class="admins">
			        <c:choose>
					      <c:when test="${mta==1}">本月员工考勤</c:when>
					      <c:when test="${mta==2}">上月员工考勤</c:when>
					      <c:when test="${mta==3}">近3月员工考勤</c:when>
					</c:choose>
				</div>
			</td>
	      </tr>
	    </table>
    </td>
    <td width="16" valign="top"><img src="<%=basePath %>attend/frame/images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td valign="middle" background="<%=basePath %>attend/frame/images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9">
    <!--    内嵌代码 Start-->
<%--    查询部分Start--%>
	<form action="Manager?sta=${mta}" name="manage" method="post">
	<TABLE height="24" cellSpacing="1" cellPadding="6" width="1080" align="center" bgColor="#D9EDC0" border="0">
	  <TBODY>
		  <TR>
			<td width="12%" align="right" class="STYLE1">姓名：</td>
			
			
			
			
		    <td width="15%" class="STYLE1"><input class="STYLE1" name="username" title=请输入姓名查询！ type="text" value="${uname}"></td>
		    <c:if test="${userid==1421}">
		 
		    <td>
		    
			<select name="isqianhai" width="12%" title="点击选择前海！">
			  <option value="0" <c:if test="${sele==0}">selected</c:if>>后海</option>
				<option value="1" <c:if test="${sele==1}">selected</c:if>> 前海 </option>
			</select>
			</td>
			</c:if>
		    <td width="6%" align="right" class="STYLE1">日期：</td>
		    <td width="30%" class="STYLE1"><input name="startTime" value="${startTime}" type="text" style="width:120px;" class="runcode" id="startTime"/>
		    至&nbsp;<input name="endTime" value="${endTime}" type="text" style="width:120px;" class="runcode" id="endTime"/></td>
		    <td width="6%" class="STYLE1">状态：</td>
		    <td width="12%" class="STYLE1"><select name="state" style="width:80px; font-size:12px;" title="点击选择状态！">  
				<option value="0" <c:if test="${state==0}">selected</c:if>>----</option>
				<option value="1" <c:if test="${state==1}">selected</c:if>> 正 常 </option>
				<option value="2" <c:if test="${state==2}">selected</c:if>> 迟 到 </option>
				<option value="3" <c:if test="${state==3}">selected</c:if>> 早 退 </option>
				<option value="4" <c:if test="${state==4}">selected</c:if>> 调 休 </option>
				<option value="5" <c:if test="${state==5}">selected</c:if>> 旷 工 </option>
				<option value="6" <c:if test="${state==6}">selected</c:if>> 出 差 </option>
				<option value="7" <c:if test="${state==7}">selected</c:if>> 婚 假 </option>
				<option value="8" <c:if test="${state==8}">selected</c:if>> 年 假 </option>
				<option value="9" <c:if test="${state==9}">selected</c:if>> 病 假 </option>
				<option value="10" <c:if test="${state==10}">selected</c:if>> 事 假 </option>
				<option value="11" <c:if test="${state==11}">selected</c:if>> 丧 假 </option>
				<option value="12" <c:if test="${state==12}">selected</c:if>> 产 假 </option>
				<option value="13" <c:if test="${state==13}">selected</c:if>> 陪产假 </option>
     				</select></td>
		    <td width="19%" class="STYLE1"><input class="coolbg np" name="submit1" type="submit" value="查  询"></td>
		  </TR>
	  </TBODY>
	</TABLE>
	</form>
<%--	查询部分End--%>
<%--	中间部分Tbale Start--%>
	<form action="ChooseManage" name="cm" method="post">
		<input name="sta" type="hidden" value="${mta}">
		<input name="startTime" type="hidden" value="${startTime}">
		<input name="endTime" type="hidden" value="${endTime}">
		<input name="currentPage" type="hidden" value="${page.currentPage}">
      <TABLE cellSpacing="1" cellPadding="3" width="1080" align="center" bgColor="#c0de98" border="0">
	  <TBODY>
	  <TR align="middle">
        <td width="5%" height="25" background="<%=basePath %>attend/images/tab_14.gif">全选</td>
	    <td width="8%" background="<%=basePath %>attend/images/tab_14.gif" >姓  名</td>
	    <td width="6%" background="<%=basePath %>attend/images/tab_14.gif" >编  号</td>
	    <td width="10%" background="<%=basePath %>attend/images/tab_14.gif" >校  区</td>
	    <td width="8%" background="<%=basePath %>attend/images/tab_14.gif" >星  期</td>
	    <td width="8%" background="<%=basePath %>attend/images/tab_14.gif" >日  期</td>
	    <td width="6%" background="<%=basePath %>attend/images/tab_14.gif" >上班时间</td>
	    <td width="6%" background="<%=basePath %>attend/images/tab_14.gif" >下班时间</td>
	    <td width="6%" background="<%=basePath %>attend/images/tab_14.gif" >状  态</td>
	    <td width="8%" background="<%=basePath %>attend/images/tab_14.gif" >迟到分钟</td>
	    <td width="8%" background="<%=basePath %>attend/images/tab_14.gif" >早退分钟</td>
		<td width="8%" background="<%=basePath %>attend/images/tab_14.gif" >确认状态</td>
		<td width="14%" background="<%=basePath %>attend/images/tab_14.gif" >操  作</td> 
	  </TR>
	  <c:choose>
	  	<c:when test="${len!=0}">
		  <c:forEach items="${attlist}" var="attendance">
		  <TR align="middle" bgColor="#ffffff" onMouseOver="this.bgColor='#cccccc';" onMouseOut="this.bgColor='#ffffff';">
			    <td height="25" align="center">
			    	<c:choose>
		            	<c:when test="${attendance.attupdatestate==0}"><input name="items" id="items" type="checkbox" value="${attendance.attid}"/></c:when>
		            	<c:otherwise><input type="checkbox" title="不可勾选" disabled/></c:otherwise>
	          		</c:choose>
	          	</td>
			    <td height="25" align="center">${attendance.username}</td>
			    <td align="center">${attendance.badgenumber}</td>
			    <td align="center">${attendance.deptname}</td>
			    <td align="center">
		            	<c:if test="${attendance.attweek==1}"><font color="red">星期天</font></c:if>
		            	<c:if test="${attendance.attweek==2}">星期一</c:if>
		            	<c:if test="${attendance.attweek==3}">星期二</c:if>
		            	<c:if test="${attendance.attweek==4}">星期三</c:if>
		            	<c:if test="${attendance.attweek==5}">星期四</c:if>
		            	<c:if test="${attendance.attweek==6}">星期五</c:if>
		            	<c:if test="${attendance.attweek==7}"><font color="red">星期六</font></c:if>
	            </td>
			    <td align="center">
			    <a href="javascript:openManage('${attendance.attdate}',${attendance.userId});">
				    <c:choose>
		            	<c:when test="${attendance.attweek==1||attendance.attweek==7}"><font color="red">${attendance.attdate}</font></c:when>
		            	<c:otherwise>${attendance.attdate}</c:otherwise>
		           	</c:choose>
		        </a>
	           	</td>
			    <td align="center">${attendance.attworktime}</td>
			    <td align="center">${attendance.attclosingtime}</td>
			    <td align="center">
	            	<c:if test="${attendance.attstate==1}"><font color="green">正常</font></c:if>
	            	<c:if test="${attendance.attstate==2}"><font color="#F0C911">迟到</font></c:if>
	            	<c:if test="${attendance.attstate==3}"><font color="#F0C911">早退</font></c:if>
	            	<c:if test="${attendance.attstate==4}"><font color="#F0C911">调休</font></c:if>
	            	<c:if test="${attendance.attstate==5}"><font color="#FF0000">旷工</font></c:if>
	            	<c:if test="${attendance.attstate==6}"><font color="#0000FF">出差</font></c:if>
	            	<c:if test="${attendance.attstate==7}"><font color="#FF6600">婚假</font></c:if>
	            	<c:if test="${attendance.attstate==8}"><font color="#F72056">年假</font></c:if>
	            	<c:if test="${attendance.attstate==9}"><font color="#999999">病假</font></c:if>
	            	<c:if test="${attendance.attstate==10}"><font color="#F0C911">事假</font></c:if>
	            	<c:if test="${attendance.attstate==11}"><font color="#F0C911">丧假</font></c:if>
	            	<c:if test="${attendance.attstate==12}"><font color="#F0C911">产假</font></c:if>
	            	<c:if test="${attendance.attstate==13}"><font color="#F0C911">陪产假</font></c:if>
	            </td>
			    <td align="center">
			    	<c:choose>
		            	<c:when test="${attendance.attlatetime==0}"><font color="#FF3300">未迟到</font></c:when>
		            	<c:otherwise>${attendance.attlatetime}<font color="#6666CC">分钟</font></c:otherwise>
		            </c:choose>
	            </td>
			    <td align="center">
			    	<c:choose>
		            	<c:when test="${attendance.attearlytime==0}"><font color="#FF3300">未早退</font></c:when>
		            	<c:otherwise>${attendance.attearlytime}<font color="#6666CC">分钟</font></c:otherwise>
		            </c:choose>
	            </td>
			    <td align="center">
		            	<c:if test="${attendance.attconfirm==0}"><font color="#FF3300">待处理</font></c:if>
		            	<c:if test="${attendance.attconfirm==1}"><font color="green">已确认</font></c:if>
		            	<c:if test="${attendance.attconfirm==2}"><font color="green">申诉中</font></c:if>
		            	<c:if test="${attendance.attconfirm==3}"><font color="#FF3300">申诉成功</font></c:if>
		            	<c:if test="${attendance.attconfirm==4}"><font color="#660033">已驳回</font></c:if>
		            	<c:if test="${attendance.attconfirm==5}"><font color="#660033">待确认</font></c:if>
	            </td>
	            <!-- -->
	            <c:choose>
	            	<c:when test="${not empty attendance.attworktime}">
					    <td align="center">
		            	  		<c:if test="${attendance.attupdatestate==0}">[<a href="UpState?attID=${attendance.attid}&currentPage=${page.currentPage}&startTime=${startTime}&endTime=${endTime}&sta=${mta}&na=${uname}" title="点击快速处理" onClick="return excuteDel()"><font color="green">确认</font></a>]&nbsp;[<a href="<%=basePath %>attend/backstage/update.jsp?attID=${attendance.attid}&currentPage=${page.currentPage}&startTime=${startTime}&endTime=${endTime}&sta=${mta}&na=${uname}"><font color="green">处理</font></a>]</c:if>
			            	  	<c:if test="${attendance.attupdatestate==1}">[<a href="<%=basePath %>attend/backstage/update.jsp?attID=${attendance.attid}&currentPage=${page.currentPage}&startTime=${startTime}&endTime=${endTime}&sta=${mta}&na=${uname}" title="点击再次处理"><font color="red">已处理</font></a>]</c:if>
			            	  	<c:if test="${attendance.attupdatestate==2}"><font color="red">申诉成功</font></c:if>
			            	  	<c:if test="${attendance.attupdatestate==3}"><font color="red">申诉中</font></c:if>
			            	  	<c:if test="${attendance.attupdatestate==4}"><font color="Green">已处理</font></c:if>
		                </td>
		            </c:when>
	         		<c:otherwise>
		          		<td align="center">
		            	 	 	<c:if test="${attendance.attupdatestate==0}">[<a href="UpState?attID=${attendance.attid}&currentPage=${page.currentPage}&startTime=${startTime}&endTime=${endTime}&sta=${mta}&na=${uname}" title="点击快速处理" onClick="return excuteDel()"><font color="green">确认</font></a>][<a href="<%=basePath %>attend/backstage/update.jsp?attID=${attendance.attid}&currentPage=${page.currentPage}&startTime=${startTime}&endTime=${endTime}&sta=${mta}&na=${uname}"><font color="green">处理</font></a>][<a href="<%=basePath %>attend/backstage/spec.jsp?attID=${attendance.attid}&currentPage=${page.currentPage}&startTime=${startTime}&endTime=${endTime}&sta=${mta}&na=${uname}"><font color="#802EBF">特殊处理</font></a>]</c:if>
		            	  		<c:if test="${attendance.attupdatestate==1}">[<a href="<%=basePath %>attend/backstage/update.jsp?attID=${attendance.attid}&currentPage=${page.currentPage}&startTime=${startTime}&endTime=${endTime}&sta=${mta}&na=${uname}" title="点击再次处理"><font color="red">已处理</font></a>]</c:if>
			            	  	<c:if test="${attendance.attupdatestate==2}"><font color="red">申诉成功</font></c:if>
			            	  	<c:if test="${attendance.attupdatestate==3}"><font color="red">申诉中</font></c:if>
			            	  	<c:if test="${attendance.attupdatestate==4}"><font color="Green">已处理</font></c:if>
				        </td>
			        </c:otherwise>
		        </c:choose> 
		  </TR>
		  </c:forEach>
	  </c:when>
	  	<c:otherwise>
		  	<TR align="middle" bgColor="#ffffff">
				<TD height="24" colspan="13"><font color="red">无记录</font></TD>
		  	</TR>
	  	</c:otherwise>
	  </c:choose>
	  <TR align="middle" bgColor="#eafcd5">
		<TD height="24" colspan="13" align="left">
			<a href="javascript:void(0);" class="coolbg" id="checkOpp">全选</a>
<%--			<a href="javascript:void(0)" class="coolbg" id="checkOpp">反选</a>--%>
<%--			<a href="javascript:noSelAll()" class="coolbg">取消</a>--%>
<%--			<a href="javascript:sure()" class="coolbg">&nbsp;一键确认&nbsp;</a>--%>
			<input type="hidden" id="nameA" name="hial"/>
			<input name="submit" id="SubmitID" type="submit" class="coolbg" value="一键确认" onClick="return excuteDel()"/>
<%--			<a href="javascript:chArc(0)" class="coolbg">&nbsp;处理&nbsp;</a>--%>
<%--			<a href="javascript:chArc(1)" class="coolbg">&nbsp;特殊处理&nbsp;</a>--%>
		</TD>
	  </TR>
	 </TBODY>
	</TABLE>
	</form>
<%--中间部分Tbale End--%>
<%--分页部分Start--%>
	<TABLE height="24" cellSpacing="1" cellPadding="6" width="1080" align="center" bgColor="#D9EDC0" border="0">
		<TBODY>
		  <TR>
		   	<TD width="750" bgColor="#D9EDC0">
		   		<span class="STYLE1">
			   		共<font color="#FF0000">${page.totalRows}</font>条纪录，当前第<font color="#0066FF">${page.currentPage}</font>页/共<font color="#0066FF">${page.totalPages}</font>页，每页<font color="#FF0000">${page.pageSize}</font>条纪录
	                &nbsp;&nbsp;<label title="请输入全名查询哦！">迟到统计分钟：<font color="#FF0000">${masum.lateSum}</font>分钟</label>
            	</span>
            </TD>
            <TD width="330" bgColor="#D9EDC0">
            	<span align="right">
            		<a href="Manager?pagerMethod=first&sta=${mta}&isqianhai=${sele}"><img src="<%=basePath %>attend/images/first.gif" width="37" height="15" border="0" /></a>
            		<a href="Manager?pagerMethod=previous&currentPage=${page.currentPage}&sta=${mta}&isqianhai=${sele}"><img src="<%=basePath %>attend/images/back.gif" width="43" height="15" border="0" /></a>
            		<a href="Manager?pagerMethod=next&currentPage=${page.currentPage}&sta=${mta}&isqianhai=${sele}"><img src="<%=basePath %>attend/images/next.gif" width="43" height="15" border="0" /></a>
            		<a href="Manager?pagerMethod=last&sta=${mta}&isqianhai=${sele}"><img src="<%=basePath %>attend/images/last.gif" width="37" height="15" border="0" /></a>
            		转到第<input id="txtCurrentPage" type="text" title="请输入整数哦！" style="height:18px; width:30px; font-size:12px" size="5" />页
            		<a href="javascript:void(0);" onClick="reloadGo(sta='${mta}');"><img src="<%=basePath %>attend/images/go.gif" width="37" height="15" border="0" /></a>
            	</span>
            </TD>
		  </TR>
		</TBODY>
	</TABLE>
<%--	分页部分End--%>
<!--内嵌代码 end-->
	</td>
    <td background="<%=basePath %>attend/frame/images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="bottom"><img src="<%=basePath %>attend/frame/images/buttom_left2.gif" width="17" height="17" /></td>
    <td background="<%=basePath %>attend/frame/images/buttom_bgs.gif"><img src="<%=basePath %>attend/frame/images/buttom_bgs.gif" width="17" height="17" /></td>
    <td valign="bottom"><img src="<%=basePath %>attend/frame/images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
  </body>
</html>
